﻿<template>
	<div>
		 <div class="layout-main">
            <el-row style="margin-bottom:12px">
                <el-button v-on:click="add()" size="small" type="primary">添加</el-button>
            </el-row>
    
	 
      			<el-form ref="saleOrderItem"   label-position="right" :label-width="80" :model="saleOrderItem" :rules="rules" >
						<input type="hidden" :model="saleOrderItem.id" />
          		  				  		  <el-form-item label="" prop="orderId">
							<el-input v-model="saleOrderItem.orderId" placeholder=""  style="width: 240px"/>
					</el-form-item>
						  		  <el-form-item label="类型1，送货单，2生产条码" prop="type">
							<el-input v-model="saleOrderItem.type" placeholder="类型1，送货单，2生产条码"  style="width: 240px"/>
					</el-form-item>
						  		  <el-form-item label="客户订单号" prop="poErpNo">
							<el-input v-model="saleOrderItem.poErpNo" placeholder="客户订单号"  style="width: 240px"/>
					</el-form-item>
						  		  <el-form-item label="客户订单行号" prop="poLineNo">
							<el-input v-model="saleOrderItem.poLineNo" placeholder="客户订单行号"  style="width: 240px"/>
					</el-form-item>
						  		  <el-form-item label="客户物料编码" prop="productCode">
							<el-input v-model="saleOrderItem.productCode" placeholder="客户物料编码"  style="width: 240px"/>
					</el-form-item>
						  		  <el-form-item label="客户物料名称" prop="productName">
							<el-input v-model="saleOrderItem.productName" placeholder="客户物料名称"  style="width: 240px"/>
					</el-form-item>
						  		  <el-form-item label="客户规格描述" prop="productScale">
							<el-input v-model="saleOrderItem.productScale" placeholder="客户规格描述"  style="width: 240px"/>
					</el-form-item>
						  		  <el-form-item label="" prop="smallPackageCount">
							<el-input v-model="saleOrderItem.smallPackageCount" placeholder=""  style="width: 240px"/>
					</el-form-item>
						  		  <el-form-item label="大箱条码数量" prop="bigPackageCount">
							<el-input v-model="saleOrderItem.bigPackageCount" placeholder="大箱条码数量"  style="width: 240px"/>
					</el-form-item>
						  		  <el-form-item label="外箱条码数量" prop="outPackageCount">
							<el-input v-model="saleOrderItem.outPackageCount" placeholder="外箱条码数量"  style="width: 240px"/>
					</el-form-item>
							
        </el-form>
						   <div >
				         	    	<el-button    size="small" @click="cancel">取消</el-button>
				         	    		<el-button  size="small"  type="primary"  :loading="modalLoading" @click="ok">确定</el-button>
				         </div>
        </div>
		
	
			
						     
    	
	</div>
</template>
<script>
		
		export default{
		name:'SaleOrderItem',
		data(){
			 return {
					loading:false,
					modalLoading:false,
					
					others:{
							
					},
					saleOrderItem:{
					
					},
					rules:{
					},
					saleOrderItemId:null
			};
		},
		mounted:function(){
		this.saleOrderItemId=this.$route.params.saleOrderItemId;
			this.getDetail();
			
		},
		methods:{
			cbtime:function(value)
			{
				this.others;
			},
			getDetail:function(){
				if(this.saleOrderItemId==null||this.saleOrderItemId==undefined||this.saleOrderItemId=="") return ;
				var me=this;
				me.showLoading();
				me.$http.get("/saleorderitem/show_"+me.saleOrderItemId+".do").then(response=>{
					var body=response;
					if(body.status==0){
						me.saleOrderItem=body.obj;
						
					}
						me.hideLoading();
				},response=>{
					me.hideLoading();
				});
			},
			
			 ok:function(){
				 var ok=false;
				 this.$refs['saleOrderItem'].validate((valid) => {
			 		ok=valid;
                    if (valid) {
                       
                    } else {
                        this.errorMessage('请认真填写数据');
                    }
                })
                if(!ok) return ;
				var me=this;
				
					me.modalLoading=true;
				 me.$http.post("/saleorderitem/doSave.do",me.saleOrderItem).then(response=>{
                          var body=response;
                          if(body.status==0)
                          {
						  me.successMessage("保存成功！");
                            
							 me.modalEdit=false;

                          }
                          else
                          {
                            me.errorMessage("操作异常!"+body.info);
                          }
						  me.modalLoading=false;
                        },response=>{
								me.modalLoading=false;
                        });
			 },
			 cancel:function(){
				this.getDetail();
			 }
		}
	}
</script>
<style scoped>

</style>